package com.zzyd.common.helper.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.zzyd.common.helper.eventbus.Network;
import com.zzyd.common.helper.utils.NetworkHelper;

import org.greenrobot.eventbus.EventBus;

/**
 * @author wjunjie
 * @version 1.0
 * @E-mail wang_junjie007@163.com
 * @company ZZYD
 * @createTime 2018/8/1 10:28
 * @类注释: 网络监听广播
 */
public class BroadcastNetwork extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        boolean isNet = NetworkHelper.isConnected(context);
        EventBus.getDefault().post(new Network(isNet));
        Log.d("BroadcastNetwork", "onReceive: 当前网络 " + isNet);
    }
}
